/* Created By Micha Sherman, google workshop 2012
 * 
 */
package com.sporteamws;

import android.os.Parcel;
import android.os.Parcelable;
 


public class User implements Parcelable 
{

	// data members

	// user unique facebook id
	private String facebook_id;
	private String facebook_access_token;
	private String auth_token;
	private String reg_id;
	private String dev_id;

	// user first name
	private String first_name;

	// user last name
	private String last_name;

	// user age, should be grater then 8
	private int age;

	// user email, as setup in facebook
	private String email;

	// user weight, should be greater then 40
	private double weight;

	// user workout_level (0.8 is the highest(best shape) and 1 is the lowest)
	private double workout_level;

	// user gender ("male"/"female"/"unknown")
	private String gender;

	// default constructor
	public User() 
	{
		age = 0;
		facebook_id = null;
		first_name = null;
		last_name = null;
		email = null;
		workout_level = 0.9; // default value
		gender = "unknown"; // default value
		weight = 65; // default value
	}

	public User(String facebook_id,String fist_name,String last_name) 
	{
		this.age = 0;
		this.facebook_id = facebook_id;
		this.first_name = fist_name;
		this.last_name = last_name;
		this.email = null;
		this.workout_level = 0.9; // default value
		this.gender = "unknown"; // default value
		this.weight = 65; // default value
	}
	
	// member functions
	public boolean SignedIn() 
	{
		// tmp
		return false;
	}

	public String GetFirstName()
	{
		return first_name;
	}

	public String GetLastName() 
	{
		return last_name;
	}

	public int GetAge() {
		return age;
	}

	public double GetWorkoutLevel() 
	{
		return workout_level;
	}

	public String GetEmail()
	{
		return email;
	}

	public String GetFacebookID() 
	{
		return facebook_id;
	}

	public double GetWeight() 
	{
		return weight;
	}

	public String GetGender()
	{
		return gender;
	}

	public String getReg_id()
	{
		return reg_id;
	}

	public String getAuth_token() 
	{
		return auth_token;
	}

	public String getFacebook_access_token()
	{
		return facebook_access_token;
	}

	public String getDev_id()
	{
		return dev_id;
	}

	public void setDev_id(String dev_id)
	{
		this.dev_id = dev_id;
	}

	public void setFacebook_access_token(String facebook_access_token)
	{
		this.facebook_access_token = facebook_access_token;
	}

	public void setReg_id(String reg_id) 
	{
		this.reg_id = reg_id;
	}

	public void setAuth_token(String auth_token) 
	{
		this.auth_token = auth_token;
	}

	public void SetFirstName(String first_name) 
	{
		this.first_name = first_name;
	}

	public void SetLastName(String last_name) 
	{
		this.last_name = last_name;
	}

	public void SetAge(int age) 
	{
		this.age = age;
	}

	public void SetWeight(double weight) 
	{
		this.weight = weight;
	}

	public void SetEmail(String email)
	{
		this.email = email;
	}

	public void SetFacebookID(String facebook_id)
	{
		this.facebook_id = facebook_id;
	}

	public void SetWorkoutLevel(double workout_level) 
	{
		this.workout_level = workout_level;
	}

	public void SetGender(String gender) 
	{
		this.gender = gender;
	}
 
  

//Parceling part
 public User(Parcel in)
 {
     String[] data = new String[3];

     in.readStringArray(data);
     this.facebook_id = data[0];
     this.first_name = data[1];
     this.last_name = data[2];
}

public int describeContents()
{
    return 0;
}

public void writeToParcel(Parcel dest, int flags)
{
	// TODO parse with Gson
     dest.writeStringArray(new String[] {this.facebook_id,
                                         this.first_name,
                                         this.last_name});
}
 
 
 @SuppressWarnings("rawtypes")
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() 
{
     public User createFromParcel(Parcel in)
     {
         return new User(in); 
     }

     public User[] newArray(int size) 
     {
         return new User[size];
     }
};












}
